package com.yesido.javabase.leetcode.easy;

import java.util.Arrays;

/**
 * @author yesido
 * @description
 * @date 2023-07-04 12:46
 * @Version 8.3
 */
public class Day0704 {
    /**
     * @param arr
     * @return boolean
     * <p>
     * 1502
     * @date 2023-07-04 12:49
     */

    public boolean canMakeArithmeticProgression(int[] arr) {
        Arrays.sort(arr);
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] * 2 != arr[i - 1] + arr[i + 1]) {
                return false;
            }
        }
        return true;
    }


    /**
     * @param nums
     * @return boolean
     * 896
     * @date 2023-07-04 12:49
     */

    public boolean isMonotonic(int[] nums) {
        int l = 0, r = nums.length - 1;
        while (l < r) {
            if (nums[l] > nums[r]) {
                // 单调减
                return false;
            } else {
                l++;
                r--;
            }
        }
        return true;
    }

    public String toLowerCase(String s) {
    return s.toLowerCase();
    }
}
